﻿@using Abp.Json
@using MyCompanyName.AbpZeroTemplate.Localization
@using MyCompanyName.AbpZeroTemplate.MultiTenancy
@using MyCompanyName.AbpZeroTemplate.Web.Models.TenantRegistration
@addTagHelper *, PaulMiami.AspNetCore.Mvc.Recaptcha
@{
    ViewBag.DisableTenantChange = true;
}
@model TenantRegisterViewModel
@section Scripts
    {
    <script>
        window.passwordComplexitySetting = @Html.Raw(Model.PasswordComplexitySetting.ToJsonString(indented: true));
    </script>
    <environment names="Development">
        <script src="~/view-resources/Views/TenantRegistration/Register.js" asp-append-version="true"></script>
    </environment>

    <environment names="Staging,Production">
        <script src="~/view-resources/Views/TenantRegistration/Register.min.js" asp-append-version="true"></script>
    </environment>

    <recaptcha-script />
}
@section Styles{
    <link href="/metronic/common/css/login-1@(CultureHelper.IsRtl ? ".rtl":"").css" rel="stylesheet" />
}
<div class="kt-login__form">
    <div class="kt-login__title">
        <h3 class="m-0">
            @L("TenantSignUp")
        </h3>
    </div>
    <small>
        @if (Model.EditionId.HasValue)
            {
        <div class="hint text-center">(@L("Edition"): @Model.Edition.DisplayName)</div>
            }
    </small>
    <form class="kt-form register-form" asp-action="Register" method="post" id="formTenantRegister">
        <input type="hidden" Name="EditionId" value="@Model.EditionId" />
        @if (Model.EditionId.HasValue)
        {
        <input type="hidden" Name="SubscriptionStartType" value="@Model.SubscriptionStartType" />
        <input type="hidden" name="EditionPaymentType" value="@Model.EditionPaymentType" />
        }

        @if (@ViewBag.ErrorMessage != null)
        {
        <div class="alert alert-danger">
            <i class="fa fa-exclamation-triangle"></i> @ViewBag.ErrorMessage
        </div>
        }

        <h4>
            @L("TenantInformations")
        </h4>
        <div class="form-group">
            <input class="form-control" type="text" placeholder="@L("TenancyName")" name="TenancyName" required maxlength="@Tenant.MaxTenancyNameLength" />
        </div>
        <div class="form-group">
            <input class="form-control" type="text" placeholder="@L("Name")" name="Name" required maxlength="@MyCompanyName.AbpZeroTemplate.Authorization.Users.User.MaxNameLength" />
        </div>

        <h4 class="mt-2">
            @L("AccountSettings")
        </h4>
        <div class="form-group">
            <input class="form-control" type="email" placeholder="@L("AdminEmailAddress")" name="AdminEmailAddress" required maxlength="@MyCompanyName.AbpZeroTemplate.Authorization.Users.User.MaxEmailAddressLength" />
        </div>
        <div class="form-group">
            <input class="form-control" type="password" autocomplete="new-password" id="AdminPassword" placeholder="@L("AdminPassword")" name="AdminPassword" required />
        </div>
        <div class="form-group">
            <input class="form-control" type="password" autocomplete="new-password" placeholder="@L("AdminPasswordRepeat")" name="AdminPasswordRepeat" required />
        </div>
        @if (ViewBag.UseCaptcha)
        {
        <h3 class="mt-2">
            @L("Captha_Hint")
        </h3>

        <div class="form-group margin-bottom-20">
            <recaptcha />
        </div>
        }
        <div class="kt-login__actions">
            <a asp-action="SelectEdition" asp-controller="TenantRegistration">
                <button type="button" id="register-back-btn" class="btn btn-light btn-elevate kt-login__btn-secondary">@L("Back")</button>
            </a>
            <button type="submit" id="register-submit-btn" class="btn btn-primary btn-elevate kt-login__btn-primary">@L("Submit")</button>
        </div>
    </form>
</div>    